package com.markbuikema.juliana32.model.teams;

import java.io.Serializable;
import java.util.Collections;
import java.util.List;

public class Table implements Serializable {

	private static final long serialVersionUID = -2603778229625413950L;

	private List<TableRow> rows;
	private String compType;
	private String periode;

	public Table(List<TableRow> rows, String compType, String periode) {
		this.rows = rows;
		this.compType = compType;
		this.periode = periode;

		Collections.sort(this.rows);
	}

	public List<TableRow> getRows() {
		return Collections.unmodifiableList(rows);
	}

	public String getCompType() {
		return compType;
	}

	public String getPeriode() {
		return periode;
	}

	public String getName() {
		String name = "";
		if (compType.equals("R")) {
			name = "Competitie";
		} else if (compType.equals("B")) {
			name = "Beker";
		} else if (compType.equals("N")) {
			name = "Nacompetitie";
		}
	
		if (!periode.equals("S")) {
			name += " periode " + periode;
		}
		
		return name;
		

	}

}
